package com.example.demo.controller;

import com.example.demo.entity.news;
import com.example.demo.service.NewsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;

@Controller
public class NewsController {

    @GetMapping("/news")
    public String greetingForm(Model model) {
        model.addAttribute("news", new news());
        return "news";
    }

    @PostMapping("/news")
    public String greetingSubmit(@ModelAttribute news newsImpl) {
        return "result";
    }
}
